import request from "@/utils/request";

export const recommendSearch = (data) => {
  return request({
    url: "/api/product/recommendSearch",
    method: "post",
    data,
  });
};

/**
 * 店铺搜索
 * @param {*} offerId
 * @returns
 */
export const sellerSearch = (data) => {
  return request({
    url: "/api/product/sellerSearch",
    method: "post",
    data,
    withoutToken: false,
  });
};

/**
 * 商品搜索
 * @param {*} data
 * @returns
 */
export const commoditySearch = (data) => {
  return request({
    url: "/api/product/pb/commoditySearch",
    method: "post",
    withoutToken: true,
    data,
  });
};

/**
 * 获取商品详情
 * @param {*} offerId
 * @returns
 */
export const getCommodityDetail = (offerId) => {
  return request({
    url: "/api/product/getCommodityDetail",
    method: "get",
    params: { offerId },
    withoutToken: false,
  });
};

/**
 * 搜索导航
 * @param {*} keyword
 * @returns
 */
export const keywordSNQuery = (keyword) => {
  return request({
    url: "/api/product/pb/keyWordSNQuery",
    method: "get",
    params: { keyword },
    withoutToken: true,
  });
};

export const getCategory = () => {
  return request({
    url: "/api/category/pb/getCategoryList",
    method: "post",
    withoutToken: true,
  });
};

export const uploadImage = (data) => {
  return request({
    url: "/api/product/uploadImage",
    method: "post",
    data,
  });
};

export const imageQuery = (data) => {
  return request({
    url: "/api/product/imageQuery",
    method: "post",
    data,
  });
};
